The following functions are implemented by client music components of the generic music component. They are called by the generic music component, which make calls that are necessary for responding to function calls made directly by applications.
The generic music component calls your music component's MusicDerivedSetKnob function when any of the synthesizer's knobs are altered.
pascal ComponentResult (
MusicComponent mc,
long knobType,
long knobNumber,
long knobValue,
long partNumber,
Part *p,
GenericKnobDescription *gkd)
ComponentCallNow (kMusicDerivedSetKnobSelect,24);
This function is called when any knob on the synthesizer is altered. It should look at the Part record and the GenericKnobDescription record and address the synthesizer hardware appropriately to set the new knob value. For a MIDI device, this means to construct a system-exclusive MIDI packet, and send it to the MIDI routine received by the MusicDerivedSetMIDI call.
These are the possible values for the knobType parameter:
/* knobTypes for MusicDerivedSetKnob */
#define kGenericMusicKnob 1
#define kGenericMusicInstrumentKnob 2
#define kGenericMusicDrumKnob 3
The generic music component calls your music component's MusicDerivedSetPart function to use the polyphony for the part specified in the Part record.
pascal ComponentResult MusicDerivedSetPart (
MusicComponent mc,
long partNumber,
Part *p)
ComponentCallNow (kMusicDerivedSetPartSelect, 8);
The generic music component calls your music component's MusicDerivedSetInstrument function to get the complete instrument defined by the Part record to the synthesizer. This will either be by hardware addressing in the case of a NuBus card, or by constructing a MIDI packet for an external synthesizer.
pascal ComponentResult MusicDerivedSetInstrument (
MusicComponent mc,
long partNumber,
Part *p)
ComponentCallNow (kMusicDerivedSetInstrumentSelect,8);
The generic music component calls your music component's MusicDerivedSetInstrumentNumber function to set the specified part to the instrument number in the Part record.
pascal ComponentResult MusicDerivedSetInstrumentNumber (
MusicComponent mc,
long partNumber,
Part *p)
ComponentCallNow (kMusicDerivedSetInstrumentNumberSelect,8);
The generic music component calls your music component's MusicDerivedSetMIDI function to set the MIDI channel and other MIDI settings for MIDI output only. It sends MIDI out to the synthesizer.
pascal ComponentResult MusicDerivedSetMIDI(
MusicComponent mc,
MusicMIDISendProcPtr midiProc,
long refcon,
long midiChannel)
ComponentCallNow (kMusicDerivedSetMIDISelect,12);
A derived component for a MIDI synthesizer will receive this call soon after it is opened. It should store the midiProc , refCon , and midiChannel in its globals. When the derived component needs to communicate with the synthesizer, it will call the midiProc with this refCon . The midiChannel variable specifies the "system channel" of the device.
The generic music component calls your music component's MusicDerivedStoreInstrument function to store the specified instrument in a user instrument location.
pascal ComponentResult MusicDerivedStoreInstrument (
MusicComponent mc,
long partNumber,
Part *p,
long instrumentNumber )
ComponentCallNow (kMusicDerivedStoreInstrumentSelect,8);